package work.taote.myapplication;

import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

/*
* 音乐播放页面
* 20250827
* 高彦锋
* */
public class Activity_music_play extends AppCompatActivity implements View.OnClickListener, View.OnLongClickListener {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EdgeToEdge.enable(this);
        setContentView(R.layout.activity_music_play);
        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
            Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
            return insets;
        });

        /*注册点击事件监听器：音乐播放/暂停播放*/
        ImageButton btn_music_play_or_pause = findViewById(R.id.music_play_pause);
        btn_music_play_or_pause.setOnClickListener(this);
//        btn_music_play_or_pause.setOnLongClickListener(this);

        Button btn_share = findViewById(R.id.btn_share);
        btn_share.setOnClickListener(this);

    }

    /*点击事件统一监听器*/
    @Override
    public void onClick(View v) {
        if (v.getId() == R.id.music_play_pause) {
            Log.i("play", "点击：播放/暂停");
        }
        if(v.getId() == R.id.btn_share) {
            Log.i("play", "点击：分享");
        }
    }

    @Override
    public boolean onLongClick(View v) {
        if (v.getId() == R.id.music_play_pause) {
            Log.i("play", "长按：播放/暂停");
        }
        return true;
    }
}